let num1 = [1, 3, 5, 7, 9];
let num2 = [2, 4, 6, 8, 10];

let res1 = [...new Set([...new Set(num1), ...new Set(num2)])];
console.log(res1);

let num3 = [1, 2, 2, 4, 5, 4, 5, 6, 7, 6, 8, 1];
let num4 = [2, 1, 2, 3, 4, 5, 6, 7, 5, 6, 44];

let res2 = [...num3].filter(item => new Set(num4).has(item));
console.log(res2);